<template>
  <div v-loading="loading">
    <tableComponents
      :pagination="{currentPage,pageSize,total:list.all_num}"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      @sendUserSearch="getSearch"
      :searchData="userSearchData"
      :isHaveExport="false"
      :isHaveAdd="false"
    >
      <template v-slot:table>
        <el-table
          ref="multipleTable"
          :data="list.data"
          stripe
          header-row-class-name="head_color"
          tooltip-effect="dark"
          style="width: 99.8%"
        >
          <el-table-column label="期数" min-width="35">
            <template slot-scope="scope">{{ scope.row.stage }}</template>
          </el-table-column>

          <el-table-column label="会员账号" min-width="40">
            <template slot-scope="scope">{{ scope.row.username }}</template>
          </el-table-column>

          <el-table-column label="会员昵称" min-width="40">
            <template slot-scope="scope">{{ scope.row.nickname }}</template>
          </el-table-column>

          <el-table-column label="涨跌" min-width="35">
            <template slot-scope="scope">
              <div>
                <el-tag
                  :type="scope.row.buy_type=='1'? 'success' : 'danger'"
                >{{scope.row.buy_type=='1'? '跌' : '涨'}}</el-tag>
              </div>
            </template>
          </el-table-column>

          <el-table-column label="买涨" min-width="35">
            <template slot-scope="scope">{{ scope.row.buy_up }}</template>
          </el-table-column>

          <el-table-column label="买跌" min-width="35">
            <template slot-scope="scope">{{ scope.row.buy_down }}</template>
          </el-table-column>

          <el-table-column label="是否结算" min-width="35">
            <template slot-scope="scope">{{ scope.row.is_end==0?'未结算':'已结算' }}</template>
          </el-table-column>
          <el-table-column label="时间" min-width="100">
            <template slot-scope="scope">
              <div>开始时间：{{scope.row.created_time | getTimeFormat}}</div>
              <div>结束时间：{{scope.row.update_time | getTimeFormat}}</div>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </tableComponents>
  </div>
</template>
<script>
import { early_lsSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  data() {
    return {
      userSearchData: early_lsSearchData,
      loading: false,
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,

      searchAll: {}
    };
  },

  methods: {
    getSearch(obj) {
      this.searchAll = obj;
      this.getNewsAll(obj);
    },
    getNewsAll(data) {
      this.loading = true;
      var params = {};
      data = data || {};
      params = data;
      this.$api.getPlugin.guessLs(params).then(res => {
        console.log(res);
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
        this.loading = false;
      });
    },
    handleSizeChange(val) {
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.getNewsAll(params);
      this.pageSize = val;
      // console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      // console.log(`当前页:`+val)
                this.currentPage = val;
      var params = this.searchAll;
      params.page = val;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
    },
    handleSelectionChange(val) {
      //多选框赋值
      this.multipleSelection = val;
    }
  },
  beforeCreate() {
    this.loading = true; //数据未加载之前调用loading
  },
  created() {
    this.getNewsAll();
    this.loading = false;
  },
  computed: {},
  watch: {}
};
</script>

<style lang="less" scoped>
// thead > tr > th {
//   height: 45px;
//   line-height: 45px;
// }
// td,
// th {
//   border: 1px solid #e1e3e4;
//   font-size: 12Px;
// }
// th {
//   background: #f8f8f8;
//   font-weight: normal;
//   color: #323437;
// }
// td {
//   height: 75px;
//   color: #000;
// }
// .caozuo {
//   padding-left: 50px;
// }
// .pl {
//   padding-left: 15px;
// }
// .chkBox {
//   display: block;
//   margin: 0 auto;
//   width: 18px;
//   height: 18px;
//   background: #fff;
// }
// .aBtn_1 {
//   padding: 10px;
// }
</style>
